UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Oys5DAUzK1M4Tgajhctmk5aPrLg7X7gkoeDaFVWy1ds='
WHERE
key_id = '418862c7db2737e163bf82231e123b23b4beaea8dfa3c98bb58747358a5b6450'
AND (
token = 'Oys5DAUzK1M4Tgajhctmk5aPrLg7X7gkoeDaFVWy1ds='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)