UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7Z+aW5Xcr0eQrG2rhKvUcpxG7l1xcN1iQRPg+Y0gRMY='
WHERE
key_id = 'f38a2de160bdbaab956194b2d83466432cce02ce2602c4b7a5595c98d9c0b27d'
AND (
token = '7Z+aW5Xcr0eQrG2rhKvUcpxG7l1xcN1iQRPg+Y0gRMY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)