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

Query time 0.00052