UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f9QZfUk2TlfKbDF54e3inaQ4C3SwBc+0ibYcLg15NZk='
WHERE
key_id = '2e5a1abacd88484d86fe48145e589209dae8b8716855c733b658a080ccc6708a'
AND (
token = 'f9QZfUk2TlfKbDF54e3inaQ4C3SwBc+0ibYcLg15NZk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)