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