UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JyYb8a3tl/Lv69EywLdnGFKNIzSN/W5MeyVQjBogw0Y=' 
WHERE 
  key_id = '662461d9e3b82198b1281d79a8e27fcb5c3f792f55b28659ebd68a8c11e933a1' 
  AND (
    token = 'JyYb8a3tl/Lv69EywLdnGFKNIzSN/W5MeyVQjBogw0Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042