UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FFV2gr9aS6zc2btAKQIKp2V8k5ypVpkNn7NRBKGJyYU=' 
WHERE 
  key_id = '76a5d7c642bd46e161152a5b954e7c6293cdd79102f15815037a103acb2a0e1d' 
  AND (
    token = 'FFV2gr9aS6zc2btAKQIKp2V8k5ypVpkNn7NRBKGJyYU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050