UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HsskLfKvOeB4vmSqLheN6LgUCvq1a8KicMfPhcHi5Ws='
WHERE
key_id = 'ac1e391013ab5744b2267f2352654f39542171376a14bc8fca3e8ee487843582'
AND (
token = 'HsskLfKvOeB4vmSqLheN6LgUCvq1a8KicMfPhcHi5Ws='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)