UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rvH08mgfmCPw2rrHllSAjvn1Kk0NVWjxBmIkT8CNvwQ=' 
WHERE 
  key_id = 'b327b73780a94a0d133f0fd6bba5cb86a6fb479d2ba2f2011f75651b39bc138e' 
  AND (
    token = 'rvH08mgfmCPw2rrHllSAjvn1Kk0NVWjxBmIkT8CNvwQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028