UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jS/VVBNP1WZxwXUxfj17Uic+oYWaoUgSFmlC+nvstEI='
WHERE
key_id = 'a22d7025ea22dad919e057b2cfcad875bbaeb5de26d8060c564784d6d6b92dca'
AND (
token = 'jS/VVBNP1WZxwXUxfj17Uic+oYWaoUgSFmlC+nvstEI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)