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