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