UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ux5TIYRhluamtl1YTAtZ7glgBdPe5qVOt5EflPxQxLo='
WHERE
key_id = 'a5c563a1dd3122b02a97a4e94e8e714a0f2579a7be3d7635fb4dc909db10e74e'
AND (
token = 'Ux5TIYRhluamtl1YTAtZ7glgBdPe5qVOt5EflPxQxLo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)