UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z70AOkEAqyVwdOeMQafvn1atTrLzunMYnkw1k1r8r60='
WHERE
key_id = '09936cc8ba844da0927a123bc421e2505a72224e3e35530278d321099f60b10a'
AND (
token = 'Z70AOkEAqyVwdOeMQafvn1atTrLzunMYnkw1k1r8r60='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)