UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z1Um6Lh5lOwRc/IQ20jkaN+zBEwcfOSSZksY9ipv2Yk=' 
WHERE 
  key_id = '8dbd0d1302980b527eb7e5f229cb5bc849c31f8fc58476071e1e14ec48079ef1' 
  AND (
    token = 'Z1Um6Lh5lOwRc/IQ20jkaN+zBEwcfOSSZksY9ipv2Yk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020