UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8IajgPUEP25/bNhURDOL992ZXhSpBSZPFiNxopQxpTo=' 
WHERE 
  key_id = '305eee83b113fd7a14ae5bd0dd401e560ed85cc9911a3d49daadd259c31fcd6e' 
  AND (
    token = '8IajgPUEP25/bNhURDOL992ZXhSpBSZPFiNxopQxpTo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032