UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MEGJ/iAfvuheIPHphfEm6bz9SGicoZKs7rk4hjBMgvA='
WHERE
key_id = '8d9cc803f6574b38f00250874d9863d75f33c88f8b648930e5fbc75a71a56ba1'
AND (
token = 'MEGJ/iAfvuheIPHphfEm6bz9SGicoZKs7rk4hjBMgvA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)