UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'epHEmyFxK3V0yxHlZEBvpYFlcj8Qm+F1nEjC8BI18IU='
WHERE
key_id = 'ed2a8fc80269acb059b377a4990e005f73e62c6610fe31d5fe3b1b5f723d1430'
AND (
token = 'epHEmyFxK3V0yxHlZEBvpYFlcj8Qm+F1nEjC8BI18IU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)