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