UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MCATr6zZaIfDWqOAdemNUWodVxk0lOue4a7TSjiIXs4=' 
WHERE 
  key_id = '54d3ec3c9685c23cc91cb8260fe8e38c14add2d14374219dc27e83d5db1ec9ed' 
  AND (
    token = 'MCATr6zZaIfDWqOAdemNUWodVxk0lOue4a7TSjiIXs4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047