UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'akjYPZ4OBXKcwzmHLyfsD3yWfPFGJxezZqCrnIU+sRo='
WHERE
key_id = 'bd7d055b6183c29576c338430658f2f6663e19ae57896a34e11914839fe93eaf'
AND (
token = 'akjYPZ4OBXKcwzmHLyfsD3yWfPFGJxezZqCrnIU+sRo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)