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