UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R8POj/dW5IISCLg7QXQAPhDDKgbXk8bEyaS7KaU5kHY='
WHERE
key_id = '228bb9afd8cb3ed4d4d185113050ce1f45529639103efc896610f3790f17e9c0'
AND (
token = 'R8POj/dW5IISCLg7QXQAPhDDKgbXk8bEyaS7KaU5kHY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)