UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kn5NlPRks9MEZa9meK3dCM7PC99/Gtv4S4/+D9uBINo=' 
WHERE 
  key_id = 'a8850295217f915bacc0ec39f619ad95ab21505e0b7d9b499a6ed0781d70fe2d' 
  AND (
    token = 'kn5NlPRks9MEZa9meK3dCM7PC99/Gtv4S4/+D9uBINo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041