UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'F+51cfJrqQGSaDPoMUCFO8DMuD3xHXd7F/P01ZanVEY='
WHERE
key_id = 'd8a2457c52e36f92a5acc547100afd84c60bc4bc0556d97202cddc768d78393a'
AND (
token = 'F+51cfJrqQGSaDPoMUCFO8DMuD3xHXd7F/P01ZanVEY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)