UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a6izcOziy93LyKMECpicdrXDnSg4M1VuAVl48Fe+PPE=' 
WHERE 
  key_id = '9b19fb1e75b7c1f532d4abe81d0e087231f5528e434f89cf39e7cefb67d815b7' 
  AND (
    token = 'a6izcOziy93LyKMECpicdrXDnSg4M1VuAVl48Fe+PPE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023