UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BGJYFcUR5JEwVw+CHNMbWYlUZ4OU+SUfMvVlrQO9hFc=' 
WHERE 
  key_id = '9bb34f83dd8e394f8dc5340f53e486c4edd688284e8997df8c0a1e88cedfeab4' 
  AND (
    token = 'BGJYFcUR5JEwVw+CHNMbWYlUZ4OU+SUfMvVlrQO9hFc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040